/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itschapala.dsw2.dao;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import mx.itschapala.dsw2.modelo.Confirmacion;
import mx.itschapala.dsw2.modelo.Eventos;

/**
 *
 * @author User
 */
@Stateless
public class ConfirmacionDao extends AbstractDao<Confirmacion> implements ConfirmacionDaoLocal {
    @PersistenceContext(unitName = "EventoEscuela-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ConfirmacionDao() {
        super(Confirmacion.class);
    }
     @Override
        public boolean findDuplicity(Confirmacion confi) {
        //seleccionar consulta
        Query q= em.createNamedQuery("Confirmacion.findDuplicity");
        //poner parametros
        q.setParameter("event",confi.getIdConfirmacion());
       
        //ejecutar
        return !q.getResultList().isEmpty();
    }
    
}
